package sdk

// APIRes represents the response message that GitHub API returns.
type APIRes[T any] struct {
	Code    int64  `json:"code"`
	Message string `json:"message"`
	Data    T      `json:"data,omitempty"`
}

// APIError represents the error message that GitHub API returns.
type APIError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Reason  string `json:"reason"`
}

// Error convert APIError to a human readable error and return.
func (e *APIError) Error() string {
	return e.Reason
}
